Optionally use ssh settings only with vagrant ssh command#1575
Open
wbclark wants to merge 1 commit intotheforeman:masterfrom
Open
Optionally use ssh settings only with vagrant ssh command#1575wbclark wants to merge 1 commit intotheforeman:masterfrom
wbclark wants to merge 1 commit intotheforeman:masterfrom
Conversation
a06ef31 to
992c9e3
Compare
Contributor
Author
|
Pushed a fix of a bug I introduced while appeasing the linter. After re-testing it, it is once again working. |
This allows bootstrapping the user on a base image, by using default ssh settings during provisioning and user defined ssh settings when doing `vagrant ssh`.
992c9e3 to
485d9b1
Compare
|
Good |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This allows bootstrapping the user on a base image, by using
default ssh settings during provisioning and user defined
ssh settings when doing
vagrant ssh.TESTING INSTRUCTIONS:
user_playbooks/ssh-test.ymlto bootstrap the user (edit the usernames to match those you will test):NOTE: As written, this requires the feature to add the user's ssh public key to authorized_keys directly from github via their github username, from #1570
vagrant/boxes.d:Make sure ssh-agent is started and your private key has been added to it
Run
vagrant up fedora34-ssh-testand observe this still uses the defaultvagrantuser to run provisioning tasks, including creating the new user and managing its authorized_keys.Run
vagrant ssh-config fedora34-ssh-testand observe thessh_usernamefrom the box definition defined here, even though it was not used in step 4.Run
vagrant ssh fedora34-ssh-testand observe that it authenticates as thessh_usernamewith credentials from the ssh-agent.As the
ssh_usernameuser, logged in on fedora34-ssh-test box, test that the ssh-agent was forwarded to the box by using the stored credentials to authenticate to github:ssh -T [email protected]EXPECTED RESULTS:
vagrant upuses the defaultvagrantuser instead ofssh_username, whilevagrant ssh-configandvagrant sshusessh_username. all above steps are successfulACTUAL RESULTS (prior to this commit):
vagrant upfails as it tries to use thessh_usernamewhich doesn't exist until after provisioning has been run. It will appear to hang onwaiting for ssh to become availablewhile addingVAGRANT_LOG=debugwill show it attempting the connection with the not-yet-existing user.